<div class="panel panel-info">
    <div class="panel-heading">
        <h3 class="panel-title">书籍分类</h3>
    </div>
    <div class="well">
        <form class="form-inline" role="form">
            <div class="form-group">
                <label class="control-label" for="name">名称</label>
                <input type="text" class="form-control" id="name" name="name" value="<?php echo $name?>"
                       placeholder="请输入名称">
            </div>
            <div class="form-group">
                <label class="control-label" for="name">名称</label>
                <input type="text" class="form-control" id="pname" name="pname" value="<?php echo $pname?>"
                       placeholder="请输入名称">
            </div>
            <button type="submit" class="btn btn-info"> 查询</button>
        </form>
        <div class="pagination">
            <?php if(!empty($userlimit['add'])&&$userlimit['add']=="1"):?>
            <button type="button" class="btn btn-primary" id="add_item">
                添加
            </button>
            <?php endif;?>
            <?php if(!empty($userlimit['add'])&&$userlimit['add']=="1"):?>
            <button type="button" class="btn btn-primary" id="add_child">
                添加子级
            </button>
            <?php endif;?>
            <?php if(!empty($userlimit['remove'])&&$userlimit['remove']=="1"):?>
            <button type="button" class="btn btn-primary" id="remove_items">
                删除
            </button>
            <?php endif;?>
            <?php if(!empty($userlimit['edit'])&&$userlimit['edit']=="1"):?>
            <button type="button" class="btn btn-primary" id="selectAttributes">
                属性设置
            </button>
            <?php endif;?>
        </div>
    </div>
    <div class="panel-body">
        <table class="table table-condensed table-striped">
            <thead>
            <tr>
                <th><input type="checkbox" class="rows_check" /> </th>
                <th>编号</th>
                <th>名称</th>
                <th>父级分类</th>
                <th>创建时间</th>
                <th>创建人</th>
                <th>备注</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <?php if(isset($assortList['rows'])):?>
                <?php foreach($assortList['rows'] as $key=>$list):?>
                    <tr>
                        <td><input type="checkbox" class="row_check" data-attributes="<?php echo $list['attributesValue'] ?>" data-id="<?php echo $list['id'] ?>" /></td>
                        <td><?php echo $key+1 ?></td>
                        <td><?php echo $list['name'] ?></td>
                        <td><?php echo $list['pname'] ?></td>
                        <td><?php echo $list['createdon'] ?></td>
                        <td><?php echo $list['createdby'] ?></td>
                        <td><?php echo $list['remark'] ?></td>
                        <td>
                            <?php if(!empty($userlimit['edit'])&&$userlimit['edit']=="1"):?>
                            <button type="button" class="btn btn-primary update_item"  data-id="<?php echo $list['id'] ?>">
                                修改
                            </button>
                            <?php endif;?>
                            <?php if(!empty($userlimit['remove'])&&$userlimit['remove']=="1"):?>
                            <button type="button" class="btn btn-primary remove_item"  data-id="<?php echo $list['id'] ?>">
                                删除
                            </button>
                            <?php endif;?>
                            <?php if(!empty($userlimit['edit'])&&$userlimit['edit']=="1"):?>
                            <a class="btn btn-primary"  href="/product/info?assort=<?php echo $list['id'] ?>">
                                产品管理
                            </a>
                            <?php endif;?>
                        </td>
                    </tr>
                <?php endforeach; ?>
            <?php endif;?>
            </tbody>
        </table>
        <?php if($pages>1):?>
            <div class="well well-sm" style="text-align: center"><?php echo HTML::getPageHtml($page,$pages,"/product/assort?name=".$name."&pname=".$pname)?></div>
        <?php endif;?>
    </div>
</div>
<div class="modal fade" id="list_modal" tabindex="-1" role="dialog" model="ProductAssort"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    产品分类信息
                </h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" role="form" id="list_form" name="list_form">
                    <div class="form-group">
                        <input type="hidden" class="form-control" id="model_id" name="model_id" />
                        <input type="hidden" class="form-control" id="model_pid" name="model_pid" />
                    </div>
                    <div class="form-group">
                        <label for="username" class="col-sm-2 control-label">名称</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="caption" name="caption"
                                   placeholder="请输入名称">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="remark" class="col-sm-2 control-label">备注</label>
                        <div class="col-sm-10">
                            <textarea class="form-control" rows="2" id="remark" name="remark"></textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default"
                        data-dismiss="modal">关闭
                </button>
                <button type="button" id="saveForm" class="btn btn-primary">
                    保存
                </button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="attributes_modal" tabindex="-1" role="dialog" model="productInfo"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    属性信息
                </h4>
            </div>
            <div class="modal-body">
               <table class="table table-condensed table-striped">
                    <thead>
                        <tr>
                            <th><input type="checkbox" class="rows_check" /> </th>
                            <th>编号</th>
                            <th>名称</th>
                            <th>显示名称</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php if(isset($propertyList)):?>
                        <?php foreach($propertyList as $key=>$list):?>
                        <tr>
                            <td><input type="checkbox" class="attributes_row_check" data-id="<?php echo $list['id'] ?>" /></td>
                            <td><?php echo $key+1 ?></td>
                            <td><?php echo $list['name'] ?></td>
                            <td><?php echo $list['caption'] ?></td>
                        </tr>
                        <?php endforeach; ?>
                        <?php endif;?>
                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default"
                        data-dismiss="modal">关闭
                </button>
                <button type="button" id="saveAttributes" class="btn btn-primary">
                    保存
                </button>
            </div>
        </div>
    </div>
</div>


